<?php
class CategoryController extends AppController
{
	var $name = 'category';
	var $uses = array('Product','Category');
	
	function beforeFilter()
	{
		parent::beforeFilter();
		 $this->Auth->allow('*');
	}
	
	function index()
	{
		$this->set('title_for_layout', 'Categories');
		$this->loadModel('Category');
		$this->set('item', $this->Category->categoryArray());
		$this->layout='innerhome';
	}
	
	function viewall()
	{
		$this->set('title_for_layout', 'View all');
		$this->loadModel('Category');
		$this->set('item', $this->Category->categoryArray());
		$categories=$this->Product->product_counts($this->Category->viewAll());
		//pr($categories);
		$this->set('categories',$categories);
		$this->layout='home';
	}       
}